﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _011_怪物的性价比
{
    class Program
    {
        static void Main(string[] args)
        {
            Monster m1 = new Monster(100, 12, 20, 15);
            Monster m2 = new Monster(50, 20, 46, 15);
            Monster m3 = new Monster(70, 13, 20, 15);
            Monster m4 = new Monster(150, 12, 10, 10);
            Monster m5 = new Monster(200, 12, 20, 30);
            List<Monster> monster = new List<Monster>();
            monster.Add(m1);
            monster.Add(m2);
            monster.Add(m3);
            monster.Add(m4);
            monster.Add(m5);

            monster.Sort(new Comparel());
            foreach(var value in monster)
            {
                Console.WriteLine(value.bicycle);
            }

            Console.ReadKey();
        }
        public class Comparel : IComparer<Monster>
        {
            public int Compare(Monster x, Monster y)
            {
                
                if (x.Bicycle() <y.Bicycle())
                {
                    return 1;
                }else if(x.Bicycle() == y.Bicycle())
                {
                    return 0;

                }
                else
                {
                    return -1;
                }

            }
        }
    }
}
